package P038_UsingStaticInnerClasses;

import org.junit.Test;

/**
 * @ClassName : UsingStaticInnerClasses
 * @Description : 使用静态内部类提高封装性
 * @Author : wukj1
 * @Date: 2022/3/8 16:08
 **/
public class UsingStaticInnerClasses {

    @Test
    public void test(){
        Person person = new Person("张三");
        person.setHome(new Person.Home("beijing","123434"));
    }

}

class Person{
    private String name;
    private Home home;

    public Person(String _name){
        name = _name;
    }

    public void setHome(Home home) {
        this.home = home;
    }

    public static class Home{
        private String address;
        private String tel;
        public Home(String address,String tel){
            this.address = address;
            this.tel = tel;
        }
    }

}
